<?php 
class widgets extends CI_Controller  {

        /**
        * Index Page for this controller.
        *
        * Maps to the following URL
        * 		http://example.com/index.php/welcome
        *	- or -  
        * 		http://example.com/index.php/welcome/index
        *	- or -
        * Since this controller is set as the default controller in 
        * config/routes.php, it's displayed at http://example.com/
        *
        * So any other public methods not prefixed with an underscore will
        * map to /index.php/welcome/<method_name>
        * @see http://codeigniter.com/user_guide/general/urls.html
        */
        function __construct(){
            parent::__construct();
            $this->load->helper('url');
            $this->load->library('smarty3');
            $this->load->model('backend/category_model');
            $this->category_model=new category_model();
            $this->smarty=new CI_Smarty3();
            $this->smarty->error_reporting = E_ALL & ~E_NOTICE;
        }
        public function index(){
            require APPPATH . 'libraries/recaptchalib.php';
            $publickey = "6LchSt4SAAAAAMl5P6qXVtNeKoEGF9qEib7LOIeU"; // you got this from the signup page
            //echo recaptcha_get_html($publickey);
            $this->smarty
                    ->assign('cats',$this->category_model->gets())
                    ->assign('category_model',$this->category_model)
                    ->display("exp/01widget");
        }
        public function cateditor($cat=""){
            $ocat=$this->category_model->get($cat);
            $this->smarty
                    ->assign(array(
                        "ocat"=>$ocat,
                        "category_model"=>$this->category_model
                    ))
                    ->display("exp/02-step-3");
        }
        function ei(){
            echo md5('khuongxuantruong@gmail.com4KhDda468vvy9B7PtY3oAdRdK6P7YncnroQ2KLnLoPjrnW');
        }
        function getalias(){
            $text=$this->input->post("text");
            if($text=="admin"){
               $result=-1;
               $message="Từ khóa bị cấm sử dụng, vui lòng chọn tiêu đề khác";
            }else{
                $result=1;
                $message=convertUrl($text);
            }
            echo json_encode(array(
                "result"=>$result,
                "message"=>$message,
                "alias"=>$message
            ));
        }
}
?>